<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
		<title>反地址解析</title>
		<script type="text/javascript"
			src="http://api.map.baidu.com/api?v=1.3"></script>
	</head>
	<body>
		<div style="width: 520px; height: 340px; border: 1px solid gray"
			id="container"></div>
	</body>
</html>
<script type="text/javascript">
var map = new BMap.Map("container");
var pt = new BMap.Point(108.318421,22.800617);
map.centerAndZoom(pt, 15);

map.addControl(new BMap.NavigationControl());               // 添加平移缩放控件
map.addControl(new BMap.ScaleControl());                    // 添加比例尺控件
map.addControl(new BMap.OverviewMapControl());              //添加缩略地图控件

var gc = new BMap.Geocoder();    

map.addEventListener("click", function(e){        
    var point = e.point;
    gc.getLocation(point,function(rs){
        var addComp = rs.addressComponents;
        alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber);
    });        
});
</script>
